home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / ToolServer Examples / UpdateToolServerEnv < prev    next >
Encoding:
Text File  |  1998-12-03  |  1.8 KB  |  66 lines  |  [TEXT/MPS ]

  1. #    UpdateToolServerEnv
  2. #
  3. #    Copyright Apple Computer, Inc. 1991
  4. #    All Rights Reserved.
  5. #
  6. #    This script will send your variable definitions, your exports and your
  7. #    aliases to the ToolServer.  It also changes the working directory of
  8. #     the ToolServer to match that of the sending shell's directory.
  9. #
  10. #    Usage - UpdateToolServerEnv 
  11. #
  12. #    It uses shell variables {WhichToolServer} and {ToolServerRedirection}
  13. #    which are defined in the Userstartup•ToolServer script.
  14.  
  15. #    This script should not be run using the "execute" command.  This script
  16. #    will unset some variables, but we only want to do this locally.
  17. #     The following checks if we were run using the "execute" command.  The
  18. #    "execute" command doesn't pass any parameters to the script.
  19.  
  20. if {0} == ""
  21.     echo "### This script should not be run with the execute command." >> dev:stderr
  22.     exit 3
  23. end
  24.  
  25. #    Save some state we need later.
  26.  
  27. set    saveTemp     "{TempFolder}"
  28.  
  29. #     We temporarily unset the following predefined variables that are 
  30. #     initialized by the application during startup.  We may not want to
  31. #     change ToolServer's settings for these if ToolServer is running
  32. #     on a different machine.  
  33.  
  34. Unset Boot
  35. Unset SystemFolder
  36. Unset MPWVersion
  37. Unset ShellDirectory
  38. Unset PrefsFolder
  39. Unset TempFolder
  40. Unset MPW 
  41. Unset AIncludes
  42. Unset Libraries
  43. Unset CIncludes
  44. Unset CLibraries 
  45. Unset PInterfaces 
  46. Unset PLibraries
  47. Unset RIncludes 
  48. Unset Commands 
  49.  
  50. #
  51. #    Send definitions to a temp file.
  52. #
  53.  
  54. Set tempfilename "{saveTemp}updateEnvTemp"
  55. Echo > "{tempfilename}"
  56. Set     >> "{tempfilename}"
  57. Export  >> "{tempfilename}"
  58. Alias     >> "{tempfilename}"
  59. Echo "Directory `Directory`" >> "{tempfilename}"
  60.  
  61. #     Send the file to ToolServer.  Uses variables {WhichToolServer} 
  62. #    and {ToolServerRedirection}, defined by Userstartup•ToolServer.
  63.  
  64. rshell < "{tempfilename}" {WhichToolServer} {ToolServerRedirection}
  65.     
  66.